_base_ = [
    "../_base_/datasets/crowdhuman.py", "../_base_/schedules/schedule_2x.py",
    "../_base_/default_runtime.py"
]
backbone_pretrained_path = R"G:\models\torch\RepVGG-A1-train.pth"

model = dict(type="GFL",
             pretrained=backbone_pretrained_path,
             backbone=dict(type="RepVGG",
                           num_blocks=[2, 4, 14, 1],
                           width_multiplier=[1, 1, 1, 2.5],
                           out_stage_names=["stage2", "stage3", "stage4"]),
             neck=dict(type="PAFPN",
                       in_channels=[128, 256, 1280],
                       out_channels=128,
                       num_outs=3,
                       start_level=0,
                       add_extra_convs=False),
             bbox_head=dict(type="GFLHead",
                            num_classes=2,
                            in_channels=128,
                            stacked_convs=1,
                            feat_channels=128,
                            anchor_generator=dict(type="AnchorGenerator",
                                                  ratios=[1.0],
                                                  octave_base_scale=8,
                                                  scales_per_octave=1,
                                                  strides=[8, 16, 32]),
                            loss_cls=dict(type="QualityFocalLoss",
                                          use_sigmoid=True,
                                          beta=2.0,
                                          loss_weight=1.0),
                            loss_dfl=dict(type="DistributionFocalLoss",
                                          loss_weight=0.25),
                            reg_max=16,
                            loss_bbox=dict(type="GIoULoss", loss_weight=2.0)))
# training and testing settings
train_cfg = dict(assigner=dict(type="ATSSAssigner", topk=9),
                 allowed_border=-1,
                 pos_weight=-1,
                 debug=False)
test_cfg = dict(nms_pre=1000,
                min_bbox_size=0,
                score_thr=0.05,
                nms=dict(type="nms", iou_threshold=0.6),
                max_per_img=100)
# optimizer
optimizer = dict(type="SGD", lr=0.01, momentum=0.9, weight_decay=0.0001)
optimizer_config = dict(
    grad_clip=dict(_delete_=True, max_norm=35, norm_type=2))
